import sys
import os
dirName1 = sys.argv[1]
dirName2 = sys.argv[2]

def cmp(a, b):
    if a[1] < b[1]:
        return -1
    if a[1] > b[1]:
        return 1
    return 0

def listDir(dirName):
    fs = os.listdir(dirName)

    res = []
    for f in fs:
        fn = os.path.join(dirName, f)
        con = open(fn, 'rb').read()
        res.append([fn, len(con)])


    res.sort(cmp=cmp)
    #for k in res:
    #    print k
    return res

d1 = listDir(dirName1)
d2 = listDir(dirName2)

#aF = d1+d2
#aF.sort(cmp=cmp)
#for k in aF:
#    print k

ore = []
for k in d1:
    find = False
    for j in d2:
        if j[1] == k[1]:
            find = True
            ore.append([k, j])
            break
    if not find:
        ore.append([k, "Error"])
    
for k in ore:
    if k[1] == "Error":
        print k

           
